﻿
@using Newtouch.Infrastructure
@{
    ViewBag.Title = "发票状态获取";
    Layout = "~/Views/Shared/_Index.cshtml";

}
<script src="~/Content/js/index.js"></script>

<form id="form1">
    <div class="panel panel-default" style="margin-bottom:10px;">
        <div class="panel-heading">发票状态获取</div>
        <table class="form">
            <tr>
                <th class="formTitle">查询时间：</th>
                <td class="formValue" style="width:10%">
                    <input id="kssj" type="text" class="form-control input-wdatepicker formClearIgnore" style="width:90px"
                           onclick="WdatePicker({ dateFmt: 'yyyy-MM-dd' })"
                           onfocus="WdatePicker({ dateFmt: 'yyyy-MM-dd' })"
                           value="@DateTime.Now.ToString("yyyy-MM-01")" />
                </td>
                <td class="formValue" style="width:8px;float:left;">-</td>
                <td class="formValue" style="width:10%;float:left;">
                    <input id="jssj" type="text" class="form-control input-wdatepicker formClearIgnore" style="width:90px;float:left;"
                           onclick="WdatePicker({ dateFmt: 'yyyy-MM-dd' })"
                           onfocus="WdatePicker({ dateFmt: 'yyyy-MM-dd' })"
                           value="@DateTime.Now.ToString("yyyy-MM-dd")" />
                </td>
                <th class="formTitle">发票代码：</th>
                <td class="formValue">
                    <input id="fpdm" class="form-control" placeholder="发票代码" />
                </td>
                <th class="formTitle">发票号：</th>
                <td class="formValue">
                    <input id="fph" class="form-control" placeholder="发票号" />
                </td>
                <th class="formTitle">
                    <input type="button" id="btn_search" class="btn btn-md btn-primary" value="查询" />
                </th>
                <td></td>
            </tr>
        </table>
    </div>
    <div id="dv-detail">
        <table id="gridList"></table>
        <div id="gridPager"></div>
    </div>
</form>

<script type="text/javascript">

    $(function () {
        //gridList();
    });
    
    function getPostData() {
        return {
            QSRQ: $("#kssj").val().replace(/\-/g, ""),
            JZRQ: $("#jssj").val().replace(/\-/g, ""),
            FPDM: $("#fpdm").val() ,
            FPH: $("#fph").val() ,
            FPBHCXTJ :'',
        };
    }

    function gridList() {
        var $gridList = $("#gridList");
        $gridList.dataGrid({
            url: "/PurchaseManage/Purchase/GetGridJsonYY160",
            height: $(window).height() - 200,
            postData: getPostData(),
            colModel: [
                { label: '发票编号', name: 'FPBH', width: 180, align: 'left' },
                { label: '发票代码', name: 'FPDM', width: 180, align: 'left' },
                { label: '发票号', name: 'FPH', width: 180, align: 'left' },
                {
                    label: '发票状态', name: 'FPZT', width: 180, align: 'left', formatter: function (val) {
                        return $.enum.getDescByValue("EnumFPZT", val);
                    }
                },
            ],
            multiselect: false,
            //pager: "#gridPager",
            //sortname: '',
            viewrecords: true,
            ondblClickRow: function (rowid, iRow, iCol, e) {
                //btn_selectrow(rowid);
            }
        });
        $("#btn_search").click(function () {
            $('#gridList').jqGrid("clearGridData");
            $gridList.jqGrid('setGridParam', {
                postData: getPostData(),
            }).trigger('reloadGrid');
        });
    }

    //获取明细
    $('#btn_search').click(function () {
        var kssj = new Date($("#kssj").val());
        var jssj = new Date($("#jssj").val());
        if (getDaysBetween(kssj,jssj) > 30) {
            $.modalAlert("日期不能超过30天", 'warning');
            return;
        }
        gridList();
    });
</script>


